import axios from "axios";

const service = axios.create({
    // baseURL: 'https://api.imooc-front.lgdsunday.club/api', // 基础地址
    baseURL: import.meta.env.VITE_BASE_API, // 基础地址
    timeout: 5000, // 超时时间
})
service.interceptors.response.use(
    (response) => {
        const {success, message, data } = response.data
        if(success){
            return data
        }else{
            console.log(response,message)
            return Promise.reject(new Error(message))
        }
    },
);
export default service